﻿using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfMvvm.ViewModel;

namespace WpfMvvm;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    private readonly MainWindowVm _vm;

    public MainWindow()
    {
        InitializeComponent();
        _vm = new MainWindowVm();
        DataContext = _vm;
    }

    private void BtnClickMe_OnClick(object sender, RoutedEventArgs e)
    {
        // 输出当前的值
        Console.WriteLine($"{_vm.Str0}");
    }

    private void BtnChangeData_OnClick(object sender, RoutedEventArgs e)
    {
        // 改变
        _vm.Str0 += "1";
    }
}